package avicit.bdp.dgs.qa.utils.enums;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2023-03-15
 * @类说明：CheckType
 * @修改记录：
 * @注意事项：
 * @主要功能：校验类型
 */
public enum CheckType {
    NUMERIC(0, "数值型"),
    VOLATILITY(1, "波动率型");

    private final int code;

    private final String desc;

    CheckType(int code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(Integer code) {
        if (code != null) {
            CheckType[] values = CheckType.values();
            for (CheckType resourceType : values) {
                if (resourceType.getCode() == code) {
                    return resourceType.getDesc();
                }
            }
        }

        return null;
    }

    public static CheckType getTypeByCode(Integer code) {
        if (code != null) {
            CheckType[] values = CheckType.values();
            for (CheckType resourceType : values) {
                if (resourceType.getCode() == code) {
                    return resourceType;
                }
            }
        }

        return null;
    }
}
